package com.tqz.rc.spring.cloud;

import com.tqz.rc.client.naming.NamingFactory;
import com.tqz.rc.client.naming.NamingService;

import java.util.Properties;

/**
 * <p>服务管理类
 *
 * @author tianqingzhao
 * @since 2021/9/2 14:59
 */
public class TqzRcServiceManager {

    NamingService namingService;

    public NamingService getNamingService(Properties properties) {
        try {
            namingService = NamingFactory.createNamingService(properties);
            return namingService;
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    public void tqzRcServiceShutdown() {
        this.namingService.shutdown();
        this.namingService = null;
    }
}
